#ifndef TRANSACTIONSTAB_H
#define TRANSACTIONSTAB_H

#include <QtGui>
#include <QtSql>

#include "tab.h"
#include "transactionmodel.h"
#include "accountmodel.h"

namespace Ui {
	class TransactionsTab;
}

class TransactionsTab : public Tab {
	Q_OBJECT
	Q_DISABLE_COPY(TransactionsTab)
public:
	explicit TransactionsTab(QWidget *parent = 0);
	virtual ~TransactionsTab();

	void initializeModel();
	void cleanup();

	virtual void updateContents();
	virtual void flushData();

protected:
	virtual void changeEvent(QEvent *e);

private:
	int currentAccount() const;
	void disableButtonsIfNecessary();

	Ui::TransactionsTab *m_ui;
	TransactionModel *m_model;
	AccountModel *m_accountModel;

public slots:
	void slot_updateNDTransactions(const QList<QStringList>&);

private slots:
	void on_accountFilter_currentIndexChanged(int index);
	void on_deleteTransactionButton_clicked();
	void on_addTransactionButton_clicked();
};

#endif // TRANSACTIONSTAB_H
